package com.aaa.java13.generic;

import com.aaa.java13.MyPerson;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2022/7/16 16:42
 * @description：泛型方法
 * @modified By：
 * @version: 1.0
 */
public class MethodGeneric {
    /**
     * @create by: Teacher陈（86521760@qq.com）
     * @description: 将a追加到b list中
     * @create time: 2022/7/16 16:58
     * @param a
     * @param b
     * @return void
     */
    public static <T> void fromListToList(List<T> a, List<T> b) {
        for (T t : a) {
            b.add(t);
        }
    }

    public static void showAllElement1(List<?>  list){
        for (Object o : list) {
            System.out.println(o);
        }
    }
    public static void showAllElement2(List<Object>  list){
        for (Object o : list) {
            System.out.println(o);
        }
    }

    public static void main(String[] args) {
        List<MyPerson> aList= new ArrayList<>();
        List<MyPerson> bList= new ArrayList<>();
        MethodGeneric.fromListToList(aList,bList);
    }


}
